package com.hopedove.workshop.ui

import android.os.Bundle
import androidx.databinding.DataBindingUtil
import com.hopedove.base.BaseActivity
import com.hopedove.workshop.R
import com.hopedove.workshop.databinding.WorkshopLoginActivityBinding
import com.hopedove.workshop.viewmodel.WorkshopLoginViewModel
import org.koin.androidx.viewmodel.ext.android.viewModel

/**
 *  生产车间模块 - 登录界面
 */
class WorkshopLoginActivity : BaseActivity() {

    private lateinit var binding: WorkshopLoginActivityBinding
    private val viewModel: WorkshopLoginViewModel by viewModel()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = DataBindingUtil.setContentView(this, R.layout.workshop_login_activity)
        binding.vm = viewModel

        setViewModelListener()
    }

    private fun setViewModelListener() {
        observeToastText(viewModel.toastText)
        observeLoading(viewModel.loading)
        observeNavigation(viewModel.navigation)
    }

}